from day07.Employee import Employee

list_employees = [
    Employee(1001,9001,"唐僧",60000),
    Employee(1002,9002,"孙悟空",50000),
    Employee(1003,9002,"猪八戒",40000),
    Employee(1004,9001,"沙僧",30000),
    Employee(1005,9001,"小白龙",1500),
]
# #获取员工中给工资最高
# emp01 = max(list_employees,key=lambda emp: emp.money)
# print(emp01)
# print("-------------------------")
# #获取员工中给工资最低
# emp02 = min(list_employees,key=lambda emp:emp.money)
# print(emp02)
# print("-------------------------")
# #获取员工中给工资大于45000
# emp03 = filter(lambda item:item.money > 45000,list_employees)
# for item in emp03:
#     print(item)
# print("--------------------------")
# emp04 = map(lambda item:item.name,list_employees)
# print(list(emp04))
# for item in emp04:
#     print(item)
# print("--------------------------")
# for item in list_employees:
#     print(item.name)
# print("--------------------------")
#按照工资升序
emp05 = sorted(list_employees,key=lambda item:item.money,reverse=False)
for item in emp05:
    print(item)
print("----------------------------")
#按照工资升序
emp06 = sorted(list_employees,key=lambda item:item.money,reverse=True)
for item in emp06:
    print(item)